package com.service.atf.base.model;

import com.service.atf.base.core.ByteConvertion;
import com.luotao.devp.base.utils.ByteUtil;

/**
 * User: luotao
 * Date: 12-2-23
 * Time: 15:40:00
 * ��Ϸ����ID	Int		�ͻ���
 * Ʊ����	Char(20)		�ͻ���
 * �н����	Long		�ͻ���
 * �ҽ����
 * �ҽ�����	Int	2000�굽���ڵĺ�����YYYYȡ��2λ	ATF���
 */
public class TFBingo extends BaseFlow implements ByteConvertion {
    private int gameCode;

    private String ticketCode;

    private long subAwardMoney;

    private int awardDate;

    public TFBingo() {
        setType((byte) '1');
        setTradeType((byte) '4');
    }

    public int getGameCode() {
        return gameCode;
    }

    public void setGameCode(int gameCode) {
        this.gameCode = gameCode;
    }

    public String getTicketCode() {
        return ticketCode;
    }

    public void setTicketCode(String ticketCode) {
        this.ticketCode = ticketCode;
    }

    public int getAwardDate() {
        return awardDate;
    }

    public void setAwardDate(int awardDate) {
        this.awardDate = awardDate;
    }

    public long getSubAwardMoney() {
        return subAwardMoney;
    }

    public void setSubAwardMoney(long subAwardMoney) {
        this.subAwardMoney = subAwardMoney;
    }

    @Override
    public ByteConvertion byte2Object(byte[] src) {
        byte2ObjectFlow(src);
        setGameCode(ByteUtil.readInt(src, LEN_ALL));
        setTicketCode(ByteUtil.readString(src, LEN_ALL + 4, 20));
        setSubAwardMoney(ByteUtil.readLong(src, LEN_ALL + 24));
        setAwardDate(ByteUtil.readInt(src, LEN_ALL + 32));
        return this;
    }

    @Override
    public byte[] object2Byte() {
        byte[] flow = object2ByteFlow();
        byte[] result = new byte[LEN_ALL + 36];
        System.arraycopy(flow, 0, result, 0, LEN_ALL);
        ByteUtil.writeInt(result, LEN_ALL, getGameCode());
        ByteUtil.writeString(result, LEN_ALL + 4, getTicketCode(), 20);
        ByteUtil.writeLong(result, LEN_ALL + 24, getSubAwardMoney());
        ByteUtil.writeInt(result, LEN_ALL + 32, getAwardDate());
        return result;
    }
}
